<html>
<head>
	<meta charset="UTF-8">
	<meta content="IE=edge" http-equiv="X-UA-Compatible">
	<meta content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no, width=device-width" name="viewport">
	<title>4643：卡常大水题</title>
	<!-- css -->
	<link href="../css/base.min.css" rel="stylesheet">
	<link href="../css/project.min.css" rel="stylesheet">
	
	<!-- favicon -->
	<!-- ... -->
</head>
<body class="page-brand">
	<header class="header header-transparent header-waterfall ui-header">
		<ul class="nav nav-list pull-left">
			<li>
				<a data-toggle="menu" href="#menu">
					<span class="icon icon-lg">menu</span>
				</a>
			</li>
		</ul>
		<a class="header-logo header-affix-hide margin-left-no margin-right-no" data-offset-top="213" data-spy="affix">卡常大水题</a>
		<span class="header-logo header-affix margin-left-no margin-right-no" data-offset-top="213" data-spy="affix">卡常大水题</span>
	</header>
	<nav aria-hidden="true" class="menu" id="menu" tabindex="-1">
		<div class="menu-scroll">
			<div class="menu-content">
				<a class="menu-logo" href="../index.html">BZOJ离线题库</a>
				<ul class="nav">
					<li>
						<a class="waves-attach" data-toggle="collapse" href="#problems">题目</a>
						<ul class="menu-collapse collapse in" id="problems">
							<li>
								<a class="waves-attach" href="../index.html">主页</a>
							</li>
							<li>
								<a class="waves-attach" href="../list.html">题目列表</a>
							</li>
						</ul>
					</li>
					<li>
						<a class="collapsed waves-attach" data-toggle="collapse" href="#about">关于</a>
						<ul class="menu-collapse collapse" id="about">
							<li>
								<a class="waves-attach" href="../about.html">关于此项目</a>
							</li>
						</ul>
					</li>
					
				</ul>
			</div>
		</div>
	</nav>
	<main class="content">
		<div class="content-header ui-content-header">
			<div class="container">
				<h1 class="content-heading">
                卡常大水题                </h1>
                <p>时间限制：40s&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  空间限制：512MB</p>			</div>
		</div>
		<div class="container">
			<section class="content-inner margin-top-no">
				<div class="row">
					<div class="col-lg-13 col-md-13">
						<div class="card margin-bottom-no">
							<div class="card-main">
								<div class="card-inner">
									
                                <h3>题目描述</h3><p><div>这是一道卡常大水题，会做的人也不要激动，希望大家不要被卡常。</div>
<div>给定一张N个点的有向完全图，点的编号为1到N，每一条边有两个权值，注</div>
<div>意x到y的边和y到x的边的权值不一定相同。</div>
<div>现在你想选出一些边，使得任意两个点都可以仅经过这些边互相到达，并且</div>
<div>这个边集中每种权值的最大值的和尽量小。保证图中至少有两个点，因此该边集</div>
<div>显然不能为空。</div></p><hr/><h3>输入格式</h3><p><div>输入的第一行包括一个整数t，表示数据组数。</div>
<div>每组数据的第一行包括一个整数N，表示有向完全图的点数。</div>
<div>接下来是一个N&times;N的矩阵，第i行第J列的整数Aij当i=j时是0，当i&ne;j时表</div>
<div>示点i与点j之间的连边的第一种权值。</div>
<div>接下来是一个N&times;N的矩阵，第i行第j列的整数Bij当i=j时是0，当i&ne;j时表</div>
<div>示点i与点j之间的连边的第二种权值。</div>
<div>2 &le; N &le; 150， 0 &le; Aij, Bij &le; 10^9， Aii = Bii = 0</div></p><hr/><h3>输出格式</h3><p><div>输出一行一个整数，表示最小的和。</div></p><hr/><h3>样例输入</h3><pre>3
0 1 2
2 0 1
1 2 0
0 3 1
1 0 3
3 1 0</pre><hr/><h3>样例输出</h3><pre>3
一种最优解是选择边1 → 3， 3 → 2， 2 → 1， 两种权值的最大值分别是2， 1
因此答案是2 + 1 = 3。</pre><hr/><h3>提示</h3><p><div>本题时限较紧，请注意尽量选择效率高的算法。</div>
<div>高维数组寻址的效率不高，因此优化高维数组寻址可以获得很高的效率提升。</div></p><hr/><h3>题目来源</h3><p>没有写明来源</p>
								</div>
							</div>
						</div>
					</div>
				</div>
				
				
			</section>
		</div>
	</main>

	<div class="fbtn-container">
		<div class="fbtn-inner">
			<a class="fbtn fbtn-lg fbtn-brand-accent waves-attach waves-circle waves-light waves-effect" data-toggle="dropdown" aria-expanded="true"><span class="fbtn-text fbtn-text-left">Menu</span><span class="fbtn-ori icon">apps</span><span class="fbtn-sub icon">close</span></a>
			<div class="fbtn-dropup">
				<a class="fbtn fbtn-brand waves-attach waves-circle waves-light waves-effect" href="../list.html" target="_self"><span class="fbtn-text fbtn-text-left">题目列表</span><span class="icon">menu</span></a>
				<a class="fbtn fbtn-green waves-attach waves-circle waves-effect" href="../index.html" target="_self"><span class="fbtn-text fbtn-text-left">返回主页</span><span class="icon">home</span></a>
				<a class="fbtn waves-attach waves-circle waves-effect" href="http://www.lydsy.com/JudgeOnline/submitpage.php?id=4643" target="_blank"><span class="fbtn-text fbtn-text-left">提交代码</span><span class="icon">send</span></a>
				<a class="fbtn fbtn-orange waves-attach waves-circle waves-effect" href="http://www.lydsy.com/JudgeOnline/wttl/wttl.php?pid=4643" target="_blank"><span class="fbtn-text fbtn-text-left">试题讨论</span><span class="icon">chat</span></a>
				
			</div>
		</div>
	</div>

	<!-- js -->
	<script src="../js/jquery.min.js"></script>
	<script src="../js/base.min.js"></script>
	<script src="../js/project.min.js"></script>
</body>
</html>